package lab02.test32;

import com.sun.org.apache.xpath.internal.SourceTree;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class Test32 {
    public static void main(String[] args) {
        //Map
        //Entryset
        //key value
        Map<String,String> person=new HashMap<String, String>();
        person.put("id","1");
        person.put("name","张三");
        person.put("gender","男");
        person.put("age","25");
        person.put("love","爱学java");
        for (Map.Entry<String,String> entry:person.entrySet()){
            System.out.println(entry.getKey()+":"+entry.getValue());
        }
        System.out.println("集合的大小："+person.size());
        person.remove("age");
        for (Map.Entry<String,String> entry:person.entrySet()){
            System.out.println(entry.getKey()+":"+entry.getValue());
        }
        System.out.println("集合的大小："+person.size());
        //Set:去掉重复值
        /*Set<Integer> set=new HashSet<Integer>();
        set.add(12);
        set.add(56);
        set.add(78);
        for(Integer n:set){
            System.out.println(n);
        }*/
    }
}
